package com.demo.registerdemo;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Button btnReg = (Button) findViewById(R.id.button_register);
        btnReg.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                String username = ((EditText) findViewById(R.id.edit_user)).getText().toString();
                String password = ((EditText) findViewById(R.id.editpassword)).getText().toString();
                String conformPass = ((EditText) findViewById(R.id.edit_conform_password)).getText().toString();
                String phone = ((EditText) findViewById(R.id.edit_phone)).getText().toString();
                String email = ((EditText) findViewById(R.id.edit_email)).getText().toString();
                String qq = ((EditText) findViewById(R.id.edit_qq)).getText().toString();
                // 将数据装入Bundle，通过Intent发送
                Bundle b = new Bundle();
                b.putString("username", username);
                if (password.equals(conformPass))
                    b.putString("password", "两次密码相同");
                else
                    b.putString("password", "请重新输入密码");
                b.putString("phone", phone);
                b.putString("email", email);
                b.putString("qq", qq);
                Intent i = new Intent(MainActivity.this, RegInfoActivity.class);
                i.putExtras(b);
                startActivity(i);
            }
        });
    }

}
